package com.zrrd.yunchmall.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 16837
 */
@Component
public class RequestOriginParserDefinition implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        //参数名不一定必须是serviceName，任意参数名都可以
        //2.必须是请求参数吗？ 不是 请求头(header)的值也可以做授权规则限制
       //例如 httpServletRequest.getHeader("token")
        return httpServletRequest.getParameter("serviceName");
    }
}
